<br />

<p class='text-center lead'>{title}</p>

<script language="JavaScript" type="text/javascript" src='http://<?php echo base_url(); ?>assets/JS/jquery.tablesorter.js'></script>

<br>

<form class="form-horizontal" role="form">
	<div class="form-group">
		<div class="col-md-2">
			<input type = "text"  class="form-control"  name = "item_type" id = "item_type" />
		</div>
		<div class="col-md-6">
			<input type = "text"  class="form-control"  name = "item_des" id = "item_des" />
		</div>
		<div class="col-md-2">
			<input type = "text"  class="form-control"  name = "item_unit" id = "item_unit" />
		</div>
		<div class="col-md-2">
			<a class='btn btn-warning btn-sm' id="clear" role='button'>清空条件</a> 
		</div>
	</div>
</form>

<table class='table table-striped table-bordered' id = 'mytable'>
	<thead>
	<tr  class="info">
	<th class="col-md-2" ><strong>类别</strong></th>
	<th class="col-md-6" ><strong>规格描述</strong></th>
	<th class="col-md-2" ><strong>支取单位</strong></th>
	<th class="col-md-2" ><strong>操作</strong></th>
	</tr>
	</thead>
	
	<tbody>
	{items}
		<tr>
		<td>{item_type}</td>
		<td>{item_des}</td>
		<td>{item_unit}</td>
		<td></td>
		</tr>
	{/items}
	</tbody>
</table>


<script type="text/javascript" src="http://<?php echo base_url(); ?>assets/JS/jquery.tablesorter.js"></script>
<script type = "text/javascript">
jQuery(function() {
		
		
		//过滤器部分
		//清空inputs
		jQuery("#clear").click(function(){
			jQuery("table tbody tr").removeClass("hidden");
			jQuery("input").val("");
		});
		
		
		
		jQuery("#item_type").blur(function(){
			var x = jQuery("#item_type").val();
			jQuery("table tbody tr:not(.hidden)")
				.addClass("hidden")
				.find('td:eq(0)')
				.filter(":contains('"+ x +"')")
				.parent()
				.removeClass("hidden");
		});
		
		
		jQuery("#item_des").blur(function(){
			var x = jQuery("#item_des").val();
			jQuery("table tbody tr:not(.hidden)")
				.addClass("hidden")
				.find('td:eq(1)')
				.filter(":contains('"+ x +"')")
				.parent()
				.removeClass("hidden");
		});
		
		jQuery("#item_unit").blur(function(){
			var x = jQuery("#item_unit").val();
			jQuery("table tbody tr:not(.hidden)")
				.addClass("hidden")
				.find('td:eq(0)')
				.filter(":contains('"+ x +"')")
				.parent()
				.removeClass("hidden");
		});
});

</script>


<script type="text/javascript">
	jQuery("#mytable").tablesorter();
</script>
